﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Fis.Win.Map
{
    public partial class BookMapControl : DevExpress.XtraEditors.XtraUserControl
    {
        public BookMapControl()
        {
            InitializeComponent();
        }

        private void lnkRate_Click(object sender, EventArgs e)
        {
            if (Fis.Win.Utils.AppSession.RightsValidata("BOOK", "AddNew"))
                UIManager.ShowEdit<Forms.BillEditForm>("BillEditViewProvider");
        }

        private void labelControl3_Click(object sender, EventArgs e)
        {
            if (Fis.Win.Utils.AppSession.RightsValidata("BOOK", "Query"))
            {
                System.Collections.Hashtable model = new System.Collections.Hashtable();
                using (var query = new Fis.Win.Forms.BillQueryForm())
                {
                    if (query.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                    {
                        return;
                    }

                    model["filter0"] = query.FilterMaster;
                    model["filter1"] = query.FilterDetail;
                }


                UIManager.ShowList<Forms.BillListForm>("BillListViewProvider", model);
            }
        }

        private void labelControl1_Click(object sender, EventArgs e)
        {
            if (Fis.Win.Utils.AppSession.RightsValidata("BOOK", "AUDIT"))
            {
                System.Collections.Hashtable model = new System.Collections.Hashtable();
                model["FormName"] = "凭证审核";
                UIManager.ShowList<Forms.AccountTreatForm>("AccountTreatViewProvider", model);
            }
        }

        private void labelControl2_Click(object sender, EventArgs e)
        {
            if (Fis.Win.Utils.AppSession.RightsValidata("BOOK", "POST"))
            {
                System.Collections.Hashtable model = new System.Collections.Hashtable();
                model["FormName"] = "凭证过账";
                UIManager.ShowList<Forms.AccountTreatForm>("AccountTreatViewProvider", model);
            }
        }

        private void labelControl5_Click(object sender, EventArgs e)
        {
            if (Fis.Win.Utils.AppSession.RightsValidata("BOOK", "TRANS"))
            {
                System.Collections.Hashtable model = new System.Collections.Hashtable();
                model["FormName"] = "结转损益";
                UIManager.ShowList<Forms.AccountTreatForm>("AccountTreatViewProvider", model);
            }
        }

        private void labelControl4_Click(object sender, EventArgs e)
        {
            if (Fis.Win.Utils.AppSession.RightsValidata("BOOK", "RATE"))
            {
                System.Collections.Hashtable model = new System.Collections.Hashtable();
                model["FormName"] = "期末调汇";
                UIManager.ShowList<Forms.AccountTreatForm>("AccountTreatViewProvider", model);
            }
        }

        private void labelControl6_Click(object sender, EventArgs e)
        {
            if (!Fis.Win.Utils.AppSession.IsComplateInitialize)
            {
                DevExpress.XtraEditors.XtraMessageBox.Show("请先结束初始化");
                return;
            }

            if (Fis.Win.Utils.AppSession.RightsValidata("BOOK", "CLOSE"))
            {
                System.Collections.Hashtable model = new System.Collections.Hashtable();
                model["FormName"] = "结账";
                UIManager.ShowList<Forms.AccountTreatForm>("AccountTreatViewProvider", model);
            }
        }
    }
}
